<template>
  <div class="share-center-container">
    <el-container class="main-container">
      <!-- 侧边栏 -->
      <el-aside width="250px" class="sidebar">
        <el-card class="sidebar-card" shadow="hover">
          <template #header>
            <div class="sidebar-header">
              <el-icon class="header-icon"><Share /></el-icon>
              <h2 class="header-title">共享中心</h2>
            </div>
          </template>

          <el-menu
              :default-active="route.path"
              class="menu-container"
              router
              active-text-color="#409EFF"
              background-color="#fafafa"
              text-color="#333"
              border-right="none"
          >
            <el-menu-item
                index="/user/center/share/info-create"
                class="menu-item"
            >
              <el-icon class="menu-icon"><Plus /></el-icon>
              <span class="menu-text">视频发布</span>
            </el-menu-item>
            <el-menu-item
                index="/user/center/share/set-create"
                class="menu-item"
            >
              <el-icon class="menu-icon"><Document /></el-icon>
              <span class="menu-text">合集创建</span>
            </el-menu-item>
            <el-menu-item
                index="4"
                class="menu-item"
            >
              <el-icon class="menu-icon"><VideoCamera /></el-icon>
              <span class="menu-text">我的视频</span>
            </el-menu-item>
          </el-menu>
          <!-- 底部信息 -->
          <div class="sidebar-footer">
            <el-avatar :src="userStore.avatar" size="small" class="footer-avatar"></el-avatar>
            <span class="footer-text">共享空间 </span>
          </div>
        </el-card>
      </el-aside>
      <!-- 主内容区 -->
      <el-main class="main-content">
        <router-view />
      </el-main>
    </el-container>
  </div>
</template>

<script setup>
import { useRoute } from "vue-router";
import { Share, VideoCamera, Document, Plus } from '@element-plus/icons-vue'
import {useUserStore} from "@/stores/user/index.js";

const route = useRoute();
const userStore = useUserStore();

</script>

<style scoped>
.share-center-container {
  width: 100%;
  height: 100vh;
  background-color: #f5f7fa;
  overflow: hidden;
}

.main-container {
  height: 100%;
}

/* 侧边栏样式 */
.sidebar {
  background-color: #fafafa;
  border-right: 1px solid #e5e7eb;
  box-shadow: 2px 0 6px rgba(0, 0, 0, 0.02);
  z-index: 10;
}

.sidebar-card {
  border-radius: 0;
  border: none;
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* 侧边栏头部 */
.sidebar-header {
  display: flex;
  align-items: center;
  padding: 12px 0;
}

.header-icon {
  font-size: 20px;
  color: #409EFF;
  margin-right: 10px;
}

.header-title {
  font-size: 18px;
  font-weight: 600;
  color: #333;
  margin: 0;
}

/* 菜单样式 */
.menu-container {
  margin-top: 15px;
  flex: 1;
  overflow-y: auto;
}

.menu-item {
  height: 50px;
  margin-bottom: 5px;
  border-radius: 6px;
  margin-left: 8px;
  margin-right: 8px;
  transition: all 0.2s ease;
}

.menu-item:hover {
  background-color: #f0f7ff !important;
}

.menu-item.is-active {
  background-color: #e6f7ff !important;
  font-weight: 500;
}

.menu-icon {
  font-size: 18px;
  margin-right: 12px;
}

.menu-text {
  font-size: 15px;
}

/* 侧边栏底部 */
.sidebar-footer {
  display: flex;
  align-items: center;
  padding: 15px 20px;
  border-top: 1px solid #f0f0f0;
  margin-top: auto;
}

.footer-avatar {
  margin-right: 10px;
}

.footer-text {
  font-size: 12px;
  color: #999;
}


/* 响应式适配 */
@media (max-width: 992px) {
  .sidebar {
    width: 70px;
  }

  .header-title,
  .menu-text,
  .sidebar-footer {
    display: none;
  }

  .sidebar-header {
    justify-content: center;
  }

  .menu-item {
    display: flex;
    justify-content: center;
    padding: 0;
  }

  .menu-icon {
    margin-right: 0;
    font-size: 20px;
  }
}
</style>
